//该文件专用于创建整个应用的路由器
import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter)

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
//引入页面
import Home from '../pages/Home'
import SongList from '../pages/SongList'
import MyMusic from '../pages/MyMusic'
import Singer from '../pages/Singer'
import Search from '../pages/Search'
import AllLists from '../pages/AllLists'
import AllSingers from '../pages/AllSingers'
export default new VueRouter({
    routes: [
        {
            path: '/',
            component: Home
        },
        {
            name: 'songlist',
            path: '/songlist',
            component: SongList
        },
        {
            name: 'alllists',
            path: '/alllists',
            component: AllLists
        },
        {
            name: 'alllsingers',
            path: '/allsingers',
            component: AllSingers
        },
        {
            path: '/singer',
            component: Singer
        },
        {
            path: '/mymusic',
            component: MyMusic
        },
        {
            name: 'search',
            path: '/search',
            component: Search
        }
    ]
})